// $Id: request.h 96 2011-10-20 16:24:38Z cedric.shih@gmail.com $
/*
 * Copyright 2011 Cedric Shih (cedric dot shih at gmail dot com)
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; either version 2.1 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */

#ifndef REQUEST_H_
#define REQUEST_H_

#ifdef __cplusplus
extern "C" {
#endif

struct niortsp_header;

struct niortsp_version {
	unsigned int major;
	unsigned int minor;
	char *string;
};

struct zcbuffer;

struct niortsp_request {
	struct niortsp_session *session;
	char *protocol;
	char *method;
	char *uri;
	struct niortsp_version version;
	struct niortsp_headers *input_headers;
	struct niortsp_headers *output_headers;
	struct zcbuffer *buffer;
};

struct niortsp_request *niortsp_request_new(struct zcbuffer *buffer);

void niortsp_request_free(struct niortsp_request *req);

const char *niortsp_request_get_protocol(struct niortsp_request *req);

unsigned int niortsp_request_get_major(struct niortsp_request *req);

unsigned int niortsp_request_get_minor(struct niortsp_request *req);

const char *niortsp_request_get_method(struct niortsp_request *req);

const char *niortsp_request_get_uri(struct niortsp_request *req);

const char *niortsp_request_get_input_header(struct niortsp_request *req,
		const char *name);

const char *niortsp_request_get_output_header(struct niortsp_request *req,
		const char *name);

int niortsp_request_set_protocol(struct niortsp_request *req,
		const char *protocol);

int niortsp_request_set_version(struct niortsp_request *req,
		const char *version);

int niortsp_request_set_method(struct niortsp_request *req, const char *method);

int niortsp_request_set_uri(struct niortsp_request *req, const char *uri);

int niortsp_request_nset_protocol(struct niortsp_request *req,
		const char *protocol, size_t len);

int niortsp_request_nset_version(struct niortsp_request *req,
		const char *version, size_t len);

int niortsp_request_nset_method(struct niortsp_request *req,
		const char *method, size_t len);

int niortsp_request_nset_uri(struct niortsp_request *req,
		const char *uri, size_t len);

int niortsp_request_set_input_header(struct niortsp_request *req,
		const char *name, const char *value);

int niortsp_request_set_output_header(struct niortsp_request *req,
		const char *name, const char *value);

struct zcbuffer *niortsp_request_get_buffer(struct niortsp_request *req);

#ifdef __cplusplus
}
#endif

#endif /* REQUEST_H_ */
